package top.roud.scs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.roud.scs.service.SenderService;
import utils.Result;
import utils.StatusCode;

/**
 * @description : TODO
 * @author: guangrui_hu
 * @date: 2023/1/11
 * @version:
 */
@RestController
@RequestMapping("/test")
public class ProducerController {
    @Autowired
    private SenderService senderService;
    @GetMapping
    public Result<Object> send(@RequestParam("msg")String msg){
        try{
            senderService.send(msg);
        }catch (Exception e){
            return new Result<>(StatusCode.FAIL,e.getMessage());
        }
        return new Result<>(StatusCode.SUCCESS, "成功");
    }
}
